//
//  THPopView.h
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 BaseBusiness. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
@class THPopView;
typedef NS_ENUM(NSInteger,THPopViewAlignType){
    THPopViewAlignBottomType,
    THPopViewAlignCenterType, // default
};

typedef void(^THPopViewEventBlock)(THPopView *popView);
@interface THPopView : UIView

//alignType default is THPopViewAlignCenterType
@property (nonatomic,assign) THPopViewAlignType alignType;
//default is [UIColor colorWithWhite:0.5 alpha:1.0].
@property (nonatomic,retain,nullable) UIColor *backgroundColor;
//show、dismiss animate time,default is 0.2s.
@property (nonatomic,assign) CGFloat duration;
//FIFO,default is NO.
@property (nonatomic,assign) BOOL supportSinglePop;
//auto dismiss when click backgroundView,default is YES;
@property (nonatomic,assign) BOOL enableTouch;
/// priority,default is 0,FIFO 还未实现.
@property (nonatomic,assign) NSInteger priority;
/// offsetY,default is 0.
@property (nonatomic,assign) CGFloat offsetY;

/// 当前窗口栏
@property (nonatomic,retain,readonly) UIWindow *window;

@property (nonatomic,copy,nullable) THPopViewEventBlock willShowBlock;
@property (nonatomic,copy,nullable) THPopViewEventBlock didShowBlock;
@property (nonatomic,copy,nullable) THPopViewEventBlock willDismissBlock;
@property (nonatomic,copy,nullable) THPopViewEventBlock didDismissBlock;

- (instancetype)initWithFrame:(CGRect)frame
                  contentView:(UIView*)contentView;

- (instancetype)initWithFrame:(CGRect)frame
                  contentView:(UIView*)contentView
                    alignType:(THPopViewAlignType)alignType;
- (void)show;

- (void)dismiss;

- (void)showAniamte:(BOOL)animate;

- (void)dismissAniamte:(BOOL)animate;

@end

NS_ASSUME_NONNULL_END
